Skip to content

Fix self_hosted CLI routing gaps#7

Closed
andrei-hasna wants to merge 2 commits into
mainfrom
openloops/open-configs/6e8c4460-6af1-427f-bad0-cad593acc298-818053ff
Closed

Fix self_hosted CLI routing gaps#7
andrei-hasna wants to merge 2 commits into
mainfrom
openloops/open-configs/6e8c4460-6af1-427f-bad0-cad593acc298-818053ff

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Route self_hosted-capable CLI paths through ConfigStore for session --config, apply, diff, explicit profile apply, snapshots list, templates, scan, and compare.
  • Add explicit self_hosted gates before local-only sync, storage, profile membership/auto, snapshot-by-id, and maintenance commands can touch SQLite/PostgreSQL sync helpers.
  • Pass cloud apply context through CLI and MCP apply flows so dry-runs do not initialize local SQLite.
  • Add focused CLI and MCP self_hosted command-level regression coverage.

Validation

  • staged_secret_scan=clean
  • TMPDIR=/tmp TEMP=/tmp TMP=/tmp BUN_TMPDIR=/tmp BUN_INSTALL_CACHE_DIR=/tmp/bun-cache bun run typecheck
  • TMPDIR=/tmp TEMP=/tmp TMP=/tmp BUN_TMPDIR=/tmp BUN_INSTALL_CACHE_DIR=/tmp/bun-cache bun test src/data/config-store.test.ts src/cli/cloud-mode.test.ts src/cli/session.test.ts src/cli/output.test.ts src/mcp/mcp.test.ts src/mcp/http.test.ts
  • TMPDIR=/tmp TEMP=/tmp TMP=/tmp BUN_TMPDIR=/tmp BUN_INSTALL_CACHE_DIR=/tmp/bun-cache bun run build
  • HASNA_INSTRUCTIONS_API_URL=https://instructions.invalid HASNA_INSTRUCTIONS_API_KEY=dummy bun run src/cli/index.tsx apply missing --dry-run exits 1 through cloud connectivity and does not print the local DB guard

Task: 6e8c4460-6af1-427f-bad0-cad593acc298
Source PR: #6

GitHub author is andrei-hasna
GitHub reviewer pool: andrei-hasna, kriptoburak
Selected non-author reviewer: kriptoburak

…sted mode

The MCP server and the CLI status/feedback commands called the synchronous
local SQLite layer (getDatabase), which throws in self_hosted mode. That left
the instructions client unable to route to the cloud API for those paths even
though CloudConfigStore already existed.

- mcp/server.ts: resolve the active store via resolveConfigStore() and route
  all config/profile/snapshot/stats tools through it; gate local-only tools
  (sync_*, storage_push/pull/sync, feedback) with a clear self_hosted message
  instead of crashing on the local DB.
- cli status: in cloud mode, build status from the store (mode + counts) so it
  no longer throws.
- cli feedback: no-op ack in cloud mode.
- bump to 0.3.4 so fixed vs stale installs are distinguishable.

All 278 unit tests pass; MCP verified end-to-end against instructions.hasna.xyz/v1.
@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Closing this as stale/superseded rather than rejected on intent.

Evidence as of 2026-07-13: this PR head ff89914 is based on older main ancestry and conflicts with current main c9d5ec8 in package.json, src/cli/index.tsx, src/cli/storage.ts, src/lib/apply.ts, src/lib/sync.ts, and src/mcp/server.ts. The storage CLI file modified here has since been deleted on main.

Since this PR was opened, main has shipped the current Store/API architecture through @hasna/instructions v0.4.6, including later cloud-mode fixes. This PR targets the older v0.3.4-era shape, including store.mode === "cloud" and legacy storage surfaces, while current main uses the current API transport contract.

The July 7 CI success only applies to the stale PR head, not to a conflict-resolved branch against current main, and the PR has no reviews. Any remaining self_hosted/API-mode gap should be handled as a fresh branch from current main with focused tests against the current Store contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant